queue *elem, *tmp;
field_map_t *fmp;
ogue_t *ogp;
- textfile_t *tin;
- tin = textfile_init(xcsv_file.xcsvfp);
-
- while ((buff = textfile_read(tin))) {
+ while ((buff = gbfgetstr(xcsv_file.xcsvfp))) {
linecount++;
buff = lrtrim(buff);
}
}
- textfile_done(tin);
}
static void
fmp = (field_map_t *) elem;
if ((i != 0) && !(fmp->options & OPTIONS_NODELIM))
- fprintf (xcsv_file.xcsvfp, write_delimiter);
+ gbfprintf (xcsv_file.xcsvfp, write_delimiter);
if (fmp->options & OPTIONS_ABSOLUTE) {
lat = fabs(lat);
* ""%s"" to smuggle bad characters through.
*/
if (0 == strcmp(fmp->printfc, "\"%s\"")) {
- fprintf (xcsv_file.xcsvfp, "\"%s\"", obuff);
+ gbfprintf (xcsv_file.xcsvfp, "\"%s\"", obuff);
} else {
- fprintf (xcsv_file.xcsvfp, "%s", obuff);
+ gbfprintf (xcsv_file.xcsvfp, "%s", obuff);
}
next:
xfree(obuff);
}
- fprintf (xcsv_file.xcsvfp, "%s", xcsv_file.record_delimiter);
+ gbfprintf (xcsv_file.xcsvfp, "%s", xcsv_file.record_delimiter);
if (description && description != shortname)
xfree(description);
ol = strsub(ogp->val, "__FILE__", xcsv_file.fname);
if (ol) {
- fprintf(xcsv_file.xcsvfp, "%s", ol);
+ gbfprintf(xcsv_file.xcsvfp, "%s", ol);
xfree(ol);
} else {
- fprintf(xcsv_file.xcsvfp, "%s", ogp->val);
+ gbfprintf(xcsv_file.xcsvfp, "%s", ogp->val);
}
- fprintf(xcsv_file.xcsvfp, "%s", xcsv_file.record_delimiter);
+ gbfprintf(xcsv_file.xcsvfp, "%s", xcsv_file.record_delimiter);
}
waypt_disp_all(xcsv_waypt_pr);
/* output epilogue lines, if any. */
QUEUE_FOR_EACH(&xcsv_file.epilogue, elem, tmp) {
ogp = (ogue_t *) elem;
- fprintf (xcsv_file.xcsvfp, "%s%s", ogp->val, xcsv_file.record_delimiter);
+ gbfprintf (xcsv_file.xcsvfp, "%s%s", ogp->val, xcsv_file.record_delimiter);
}
}
#endif
xcsv_read_style(const char *fname)
{
char *sbuff;
- FILE *fp;
- textfile_t *tin;
+ gbfile *fp;
xcsv_file_init();
- fp = xfopen(fname, "rb", MYNAME);
- tin = textfile_init(fp);
+ fp = gbfopen(fname, "rb", MYNAME);
- while ((sbuff = textfile_read(tin))) {
+ while ((sbuff = gbfgetstr(fp))) {
sbuff = lrtrim(sbuff);
xcsv_parse_style_line(sbuff);
- } while (!feof(fp));
+ } while (!gbfeof(fp));
/* if we have no output fields, use input fields as output fields */
if (xcsv_file.ofield_ct == 0) {
xcsv_file.ofield = &xcsv_file.ifield;
xcsv_file.ofield_ct = xcsv_file.ifield_ct;
}
- textfile_done(tin);
- fclose(fp);
+ gbfclose(fp);
}
/*
warning(MYNAME " attempt to read %s as a track or route, but this module only supports waypoints on read. Reading as waypoints instead.\n", fname);
}
- xcsv_file.xcsvfp = xfopen(fname, "r", MYNAME);
+ xcsv_file.xcsvfp = gbfopen(fname, "r", MYNAME);
}
static void
xcsv_rd_deinit(void)
{
- fclose(xcsv_file.xcsvfp);
+ gbfclose(xcsv_file.xcsvfp);
xcsv_destroy_style();
}
xcsv_read_style(styleopt);
}
- xcsv_file.xcsvfp = xfopen(fname, "w", MYNAME);
+ xcsv_file.xcsvfp = gbfopen(fname, "w", MYNAME);
xcsv_file.fname = (char *)fname;
/* set mkshort options from the command line */
static void
xcsv_wr_deinit(void)
{
- fclose(xcsv_file.xcsvfp);
+ gbfclose(xcsv_file.xcsvfp);
xcsv_destroy_style();
}